From c9a3da5025a40ce8b41a67f40666a9dddf4d49fa Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 20 Oct 2010 19:02:41 +0200 Subject: [PATCH] GtkStyleContext: s/set/add/ and s/unset/remove/ for classes/regions. Several classes and regions may be set to GtkStyleContext, so rename the functions to be more intuitive. --- docs/reference/gtk/gtk3-sections.txt | 16 ++++---- gtk/gtknotebook.c | 4 +- gtk/gtkstyle.c | 60 ++++++++++++++-------------- gtk/gtkstylecontext.c | 24 +++++------ gtk/gtkstylecontext.h | 28 ++++++------- gtk/gtkwidgetpath.c | 4 +- 6 files changed, 68 insertions(+), 68 deletions(-) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index d854ff5b50..2da137cf31 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -5380,12 +5380,8 @@ gtk_style_context_get_style gtk_style_context_get_style_property gtk_style_context_get_style_valist gtk_style_context_get_valist -gtk_style_context_has_class -gtk_style_context_has_region gtk_style_context_invalidate gtk_style_context_state_is_running -gtk_style_context_list_classes -gtk_style_context_list_regions gtk_style_context_lookup_color gtk_style_context_lookup_icon_set gtk_style_context_notify_state_change @@ -5396,18 +5392,22 @@ gtk_style_context_remove_provider_for_screen gtk_style_context_reset_widgets gtk_style_context_restore gtk_style_context_save -gtk_style_context_set_class gtk_style_context_set_direction gtk_style_context_set_junction_sides gtk_style_context_set_path -gtk_style_context_set_region +gtk_style_context_add_class +gtk_style_context_remove_class +gtk_style_context_has_class +gtk_style_context_list_classes +gtk_style_context_add_region +gtk_style_context_remove_region +gtk_style_context_has_region +gtk_style_context_list_regions gtk_style_context_set_screen gtk_style_context_set_state gtk_style_context_state_transition_start gtk_style_context_state_transition_stop gtk_style_context_state_transition_update -gtk_style_context_unset_class -gtk_style_context_unset_region gtk_render_arrow diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 3ce43ee9ab..708a8d0fff 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -5068,7 +5068,7 @@ gtk_notebook_draw_tab (GtkNotebook *notebook, flags |= GTK_REGION_LAST; context = gtk_widget_get_style_context (widget); - gtk_style_context_set_region (context, "tab", flags); + gtk_style_context_add_region (context, "tab", flags); gtk_paint_extension (gtk_widget_get_style (widget), cr, state_type, GTK_SHADOW_OUT, @@ -5096,7 +5096,7 @@ gtk_notebook_draw_tab (GtkNotebook *notebook, allocation.height + 2 * focus_width); } - gtk_style_context_unset_region (context, "tab"); + gtk_style_context_remove_region (context, "tab"); } static void diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 44c3ed9731..38390c072f 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -1740,69 +1740,69 @@ transform_detail_string (const gchar *detail, return; if (strcmp (detail, "arrow") == 0) - gtk_style_context_set_class (context, "arrow"); + gtk_style_context_add_class (context, "arrow"); else if (strcmp (detail, "button") == 0) - gtk_style_context_set_class (context, "button"); + gtk_style_context_add_class (context, "button"); else if (strcmp (detail, "buttondefault") == 0) { - gtk_style_context_set_class (context, "button"); - gtk_style_context_set_class (context, "default"); + gtk_style_context_add_class (context, "button"); + gtk_style_context_add_class (context, "default"); } else if (strcmp (detail, "calendar") == 0) - gtk_style_context_set_class (context, "calendar"); + gtk_style_context_add_class (context, "calendar"); else if (strcmp (detail, "cellcheck") == 0) { - gtk_style_context_set_class (context, "cell"); - gtk_style_context_set_class (context, "check"); + gtk_style_context_add_class (context, "cell"); + gtk_style_context_add_class (context, "check"); } else if (strcmp (detail, "cellradio") == 0) { - gtk_style_context_set_class (context, "cell"); - gtk_style_context_set_class (context, "radio"); + gtk_style_context_add_class (context, "cell"); + gtk_style_context_add_class (context, "radio"); } else if (strcmp (detail, "checkbutton") == 0) - gtk_style_context_set_class (context, "check"); + gtk_style_context_add_class (context, "check"); else if (strcmp (detail, "check") == 0) { - gtk_style_context_set_class (context, "check"); - gtk_style_context_set_class (context, "menu"); + gtk_style_context_add_class (context, "check"); + gtk_style_context_add_class (context, "menu"); } else if (strcmp (detail, "option") == 0) { - gtk_style_context_set_class (context, "radio"); - gtk_style_context_set_class (context, "menu"); + gtk_style_context_add_class (context, "radio"); + gtk_style_context_add_class (context, "menu"); } else if (strcmp (detail, "entry") == 0 || strcmp (detail, "entry_bg") == 0) - gtk_style_context_set_class (context, "entry"); + gtk_style_context_add_class (context, "entry"); else if (strcmp (detail, "expander") == 0) - gtk_style_context_set_class (context, "expander"); + gtk_style_context_add_class (context, "expander"); else if (strcmp (detail, "tooltip") == 0) - gtk_style_context_set_class (context, "tooltip"); + gtk_style_context_add_class (context, "tooltip"); else if (strcmp (detail, "frame") == 0) - gtk_style_context_set_class (context, "frame"); + gtk_style_context_add_class (context, "frame"); else if (strcmp (detail, "scrolled_window") == 0) - gtk_style_context_set_class (context, "scrolled-window"); + gtk_style_context_add_class (context, "scrolled-window"); else if (strcmp (detail, "viewport") == 0 || strcmp (detail, "viewportbin") == 0) - gtk_style_context_set_class (context, "viewport"); + gtk_style_context_add_class (context, "viewport"); else if (strcmp (detail, "trough") == 0) { - gtk_style_context_set_class (context, "scrollbar"); - gtk_style_context_set_class (context, "trough"); + gtk_style_context_add_class (context, "scrollbar"); + gtk_style_context_add_class (context, "trough"); } else if (strcmp (detail, "spinbutton") == 0) - gtk_style_context_set_class (context, "spinbutton"); + gtk_style_context_add_class (context, "spinbutton"); else if (strcmp (detail, "spinbutton_up") == 0) { - gtk_style_context_set_class (context, "spinbutton"); - gtk_style_context_set_class (context, "button"); + gtk_style_context_add_class (context, "spinbutton"); + gtk_style_context_add_class (context, "button"); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM); } else if (strcmp (detail, "spinbutton_down") == 0) { - gtk_style_context_set_class (context, "spinbutton"); - gtk_style_context_set_class (context, "button"); + gtk_style_context_add_class (context, "spinbutton"); + gtk_style_context_add_class (context, "button"); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); } else if (g_str_has_prefix (detail, "cell_")) @@ -1837,9 +1837,9 @@ transform_detail_string (const gchar *detail, if (!ruled) row &= ~(GTK_REGION_EVEN | GTK_REGION_ODD); - gtk_style_context_set_class (context, "cell"); - gtk_style_context_set_region (context, "row", row); - gtk_style_context_set_region (context, "column", col); + gtk_style_context_add_class (context, "cell"); + gtk_style_context_add_region (context, "row", row); + gtk_style_context_add_region (context, "column", col); g_strfreev (tokens); } diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index f0456a4d4c..284f8521a9 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -1436,8 +1436,8 @@ gtk_style_context_get_path (GtkStyleContext *context) * @context: a #GtkStyleContext * * Saves the @context state, so all modifications done through - * gtk_style_context_set_class(), gtk_style_context_unset_class(), - * gtk_style_context_set_region(), gtk_style_context_unset_region() + * gtk_style_context_add_class(), gtk_style_context_remove_class(), + * gtk_style_context_add_region(), gtk_style_context_remove_region() * or gtk_style_context_set_junction_sides() can be reverted in one * go through gtk_style_context_restore(). * @@ -1590,7 +1590,7 @@ region_find (GArray *array, } /** - * gtk_style_context_set_class: + * gtk_style_context_add_class: * @context: a #GtkStyleContext * @class_name: class name to use in styling * @@ -1614,7 +1614,7 @@ region_find (GArray *array, * Since: 3.0 **/ void -gtk_style_context_set_class (GtkStyleContext *context, +gtk_style_context_add_class (GtkStyleContext *context, const gchar *class_name) { GtkStyleContextPrivate *priv; @@ -1641,7 +1641,7 @@ gtk_style_context_set_class (GtkStyleContext *context, } /** - * gtk_style_context_unset_class: + * gtk_style_context_remove_class: * @context: a #GtkStyleContext * @class_name: class name to remove * @@ -1650,8 +1650,8 @@ gtk_style_context_set_class (GtkStyleContext *context, * Since: 3.0 **/ void -gtk_style_context_unset_class (GtkStyleContext *context, - const gchar *class_name) +gtk_style_context_remove_class (GtkStyleContext *context, + const gchar *class_name) { GtkStyleContextPrivate *priv; GtkStyleInfo *info; @@ -1802,7 +1802,7 @@ gtk_style_context_list_regions (GtkStyleContext *context) } /** - * gtk_style_context_set_region: + * gtk_style_context_add_region: * @context: a #GtkStyleContext * @region_name: region name to use in styling * @flags: flags that apply to the region @@ -1830,7 +1830,7 @@ gtk_style_context_list_regions (GtkStyleContext *context) * Since: 3.0 **/ void -gtk_style_context_set_region (GtkStyleContext *context, +gtk_style_context_add_region (GtkStyleContext *context, const gchar *region_name, GtkRegionFlags flags) { @@ -1863,7 +1863,7 @@ gtk_style_context_set_region (GtkStyleContext *context, } /** - * gtk_style_context_unset_region: + * gtk_style_context_remove_region: * @context: a #GtkStyleContext * @region_name: region name to unset * @@ -1872,8 +1872,8 @@ gtk_style_context_set_region (GtkStyleContext *context, * Since: 3.0 **/ void -gtk_style_context_unset_region (GtkStyleContext *context, - const gchar *region_name) +gtk_style_context_remove_region (GtkStyleContext *context, + const gchar *region_name) { GtkStyleContextPrivate *priv; GtkStyleInfo *info; diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index 592d0e8c4a..a7c74b5489 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -94,23 +94,23 @@ G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *cont GList * gtk_style_context_list_classes (GtkStyleContext *context); -void gtk_style_context_set_class (GtkStyleContext *context, - const gchar *class_name); -void gtk_style_context_unset_class (GtkStyleContext *context, - const gchar *class_name); -gboolean gtk_style_context_has_class (GtkStyleContext *context, - const gchar *class_name); +void gtk_style_context_add_class (GtkStyleContext *context, + const gchar *class_name); +void gtk_style_context_remove_class (GtkStyleContext *context, + const gchar *class_name); +gboolean gtk_style_context_has_class (GtkStyleContext *context, + const gchar *class_name); GList * gtk_style_context_list_regions (GtkStyleContext *context); -void gtk_style_context_set_region (GtkStyleContext *context, - const gchar *region_name, - GtkRegionFlags flags); -void gtk_style_context_unset_region (GtkStyleContext *context, - const gchar *region_name); -gboolean gtk_style_context_has_region (GtkStyleContext *context, - const gchar *region_name, - GtkRegionFlags *flags_return); +void gtk_style_context_add_region (GtkStyleContext *context, + const gchar *region_name, + GtkRegionFlags flags); +void gtk_style_context_remove_region (GtkStyleContext *context, + const gchar *region_name); +gboolean gtk_style_context_has_region (GtkStyleContext *context, + const gchar *region_name, + GtkRegionFlags *flags_return); void gtk_style_context_get_style_property (GtkStyleContext *context, const gchar *property_name, diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c index 578335b8e7..4b4e186ca8 100644 --- a/gtk/gtkwidgetpath.c +++ b/gtk/gtkwidgetpath.c @@ -436,7 +436,7 @@ gtk_widget_path_iter_has_name (const GtkWidgetPath *path, * * Adds the class @name to the widget at position @pos in * the hierarchy defined in @path. See - * gtk_style_context_set_class(). + * gtk_style_context_add_class(). * * Since: 3.0 **/ @@ -690,7 +690,7 @@ gtk_widget_path_iter_has_class (const GtkWidgetPath *path, * * Adds the region @name to the widget at position @pos in * the hierarchy defined in @path. See - * gtk_style_context_set_region(). + * gtk_style_context_add_region(). * * Since: 3.0 **/ -- 2.30.2